<?php
/**
 * User: @lose
 * Date: 2019-10-12
 * Time: 19:09
 */

namespace Biz\model;

use Doraemon\pockets\datebase\BaseDbModel;

class CategoryWikiCard extends BaseDbModel
{
    const _CONFIG_FILE_ = 'db_shop';

    const _CONFIG_SELECT_ = 'db_shop';

    const _DATABASE_ = 'shop';

    const _TABLE_NAME = 'category_wiki_card';

    const STATUS_NORMAL = 1;
    const STATUS_DELETE = 9;

    public static function getListByWhere($where, $limit = [], $order = [], $field = '*')
    {
        return self::select($field, [
            'AND' => $where,
            'LIMIT' => $limit,
            'ORDER' => $order
        ]);
    }

    public static function getCount($where)
    {
        return self::count($where);
    }

    public static function getInfo($where, $field = '*')
    {
        return self::get($field, $where);
    }

    public static function addData($data)
    {
        return self::insert($data)->rowCount();
    }

    public static function updateById($id)
    {
        return self::update(['card_status' => self::STATUS_DELETE], ['id' => $id])->rowCount();
    }
}